//
//  UIScrollView+YSZoomHeader.m
//  YSKitDemo
//
//  Created by MOLBASE on 2018/8/13.
//  Copyright © 2018年 YangShen. All rights reserved.
//

#import "UIScrollView+YSZoomHeader.h"
#import "YSZoomHeader.h"
#import <objc/runtime.h>

@implementation UIScrollView (YSZoomHeader)

- (void)setYs_zoomHeader:(YSZoomHeader *)ys_zoomHeader {
    if (self.ys_zoomHeader != ys_zoomHeader) {
        [self.ys_zoomHeader removeFromSuperview];
        [self insertSubview:ys_zoomHeader atIndex:0];
        objc_setAssociatedObject(self, @selector(ys_zoomHeader), ys_zoomHeader, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    }
}

- (YSZoomHeader *)ys_zoomHeader {
    return objc_getAssociatedObject(self, @selector(ys_zoomHeader));
}

@end
